﻿using Core.Model.Questions;
using FluentNHibernate.Automapping;
using FluentNHibernate.Automapping.Alterations;

namespace Core.DataAccess.Tools.Implementations.OverrideMappings
{
    public class QuestionMapping : IAutoMappingOverride<Core.Model.Questions.Question>
    {
        #region Implementation of IAutoMappingOverride<Question>

        public void Override(AutoMapping<Question> mapping)
        {
            mapping.References(x => x.QuestionList, "QuestionListId").Cascade.None();
            mapping.HasMany(x => x.Answers).KeyColumn("QuestionId").Cascade.All();
        }

        #endregion
    }
}
